home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / WINPROGS / WUNZ20SR.ZIP / WINIT.C < prev    next >
C/C++ Source or Header  |  1992-07-02  |  2KB  |  66 lines

  1. #include "wizunzip.h"
  2.  
  3. long FAR PASCAL WizUnzipWndProc(HWND, WORD, WORD, LONG);
  4.  
  5. /****************************************************************************
  6.  
  7.     FUNCTION: WizUnzipInit(HANDLE)
  8.  
  9.     PURPOSE: Initializes window data and registers window class
  10.  
  11.     COMMENTS:
  12.  
  13.         Sets up a structure to register the window class.  Structure includes
  14.         such information as what function will process messages, what cursor
  15.         and icon to use, etc.
  16.  
  17.         This provides an example of how to allocate local memory using the
  18.         LocalAlloc() call instead of malloc().  This provides a handle to
  19.         memory.  When you actually need the memory, LocalLock() is called
  20.         which returns a pointer.  As soon as you are done processing the
  21.         memory, call LocalUnlock so that Windows can move the memory as
  22.         needed.  Call LocalLock() to get a pointer again, or LocalFree() if
  23.         you don't need the memory again.
  24.  
  25.  
  26. ****************************************************************************/
  27. BOOL WizUnzipInit(HANDLE hInstance)
  28. {
  29.     WNDCLASS wndclass;
  30.  
  31.     wndclass.style = CS_HREDRAW | CS_VREDRAW;
  32.     wndclass.lpfnWndProc = (long (FAR PASCAL*)(HWND,unsigned ,unsigned,LONG))WizUnzipWndProc;
  33.     wndclass.hInstance = hInstance;
  34.     wndclass.hIcon = LoadIcon(hInstance, "WizUnzip");
  35.     wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
  36.     wndclass.hbrBackground = BG_SYS_COLOR+1; /* set background color */
  37.     wndclass.lpszMenuName = (LPSTR) "WizUnzip";
  38.     wndclass.lpszClassName = (LPSTR) szAppName;
  39.     wndclass.cbClsExtra     = 0;
  40.     wndclass.cbWndExtra     = 0;
  41.  
  42.  
  43.     if ( !RegisterClass(&wndclass) )
  44.     {
  45.         return FALSE;
  46.     }
  47.  
  48.     /* define status class */
  49.     wndclass.lpszClassName = (LPSTR) szStatusClass;
  50.     wndclass.style = CS_HREDRAW | CS_VREDRAW;
  51.     wndclass.lpfnWndProc = (long (FAR PASCAL*)(HWND,unsigned,unsigned,LONG))StatusProc;
  52.     wndclass.hInstance = hInstance;
  53.     wndclass.hIcon = NULL;
  54.     wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
  55.     wndclass.hbrBackground = GetStockObject(WHITE_BRUSH);
  56.     wndclass.lpszMenuName = NULL;
  57.  
  58.     if ( !RegisterClass(&wndclass) )
  59.     {
  60.         return FALSE;
  61.     }
  62.  
  63.     return TRUE;
  64. }
  65.  
  66.